package com.zy.convert.converter;

import com.zy.convert.core.AbstractConverter;
import com.zy.convert.core.ConvertContext;
import com.zy.convert.core.ConvertListContext;

import java.util.function.Function;

/**
 * @author hassan
 * @date 2020-02-24 17:29
 *  示例 converter
 *  只是将 简单返回sourceField值
 */
public class Field2FieldConverter extends AbstractConverter<Field2Field,Object,Object> {

    @Override
    public Object convert(ConvertContext<Field2Field, Object> context) {
        return context.getSourceValue();
    }

    @Override
    public Function<ConvertContext<Field2Field, Object>, Object> convertList(ConvertListContext<Field2Field, Object> convertListContext) {
        return ConvertContext::getSourceValue;
    }
}
